package com.taritari.journal.task;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author taritari
 * @date 2024-01-17 16:20
 * @description 树洞功能的定时任务
 */
@Component
@Slf4j
public class TreeHoleTask {

    private final AtomicInteger counts = new AtomicInteger();

//    @Scheduled(cron = "0/5 * * * * *") //每五秒执行一次
    @Scheduled(cron = "0 0 12 * * ?") //中午十二点执行
    public void execute() {

        log.info("[定时任务第 {} 次执行]", counts.incrementAndGet());
    }
}